#ifndef I2CDRIVE_H
#define I2CDRIVE_H

#include "my_define.h"

#define I2C_FAST 1			//1减少非必要延时 0常规版本

#define I2C_WR   0
#define I2C_RD   1

typedef struct{
	void (*IIC_InitPort)(void);   //硬件IO初始化
	void (*IIC_SDA_H)();          //SDA_H
	void (*IIC_SDA_L)();          //SDA_L
	void (*IIC_SCL_H)();          //SCL_H
	void (*IIC_SCL_L)();          //SCL_L
	u8   (*IIC_READ_SDA)();       //读SDA
	u8   (*IIC_READ_SCL)();   	  //读SCL
}mI2CTypedef_t;

void i2c_Start(mI2CTypedef_t *i2c );
void i2c_Stop(mI2CTypedef_t *i2c );
void i2c_SendByte(mI2CTypedef_t *i2c,u8 _ucByte);
u8 i2c_ReadByte(mI2CTypedef_t *i2c);
u8 i2c_WaitAck(mI2CTypedef_t *i2c);
void i2c_Ack(mI2CTypedef_t *i2c);
void i2c_NAck(mI2CTypedef_t *i2c);
u8 i2c_CheckDevice(mI2CTypedef_t *i2c,u8 _Address);
void i2c_SdaErrorClear(mI2CTypedef_t *i2c);

#endif
